﻿using DocumentFormat.OpenXml.Lite.DrawingML.Geometry.Properties;
using DocumentFormat.OpenXml.Lite.DrawingML.Types;
using DocumentFormat.OpenXml.Lite.Shared;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.DrawingML.Chart.Elements
{
    [XmlRoot("trendline", Namespace = Constants.Chart)]
    public class Trendline : XmlSerializable
    {
        [Optional]
        [XmlElement("name", Namespace = Constants.Chart)]
        public SimpleText Name { get; set; }

        [Optional]
        [XmlElement("spPr", Namespace = Constants.Chart)]
        public ShapeProperties ShapeProperties { get; set; }

        [XmlElement("trendlineType", Namespace = Constants.Chart)]
        public NullableValue<ST_TrendlineType> TrendlineType { get; set; }

        [Optional]
        [XmlElement("order", Namespace = Constants.Chart)]
        public NullableValue<byte> Order { get; set; }

        [Optional]
        [XmlElement("period", Namespace = Constants.Chart)]
        public NullableValue<byte> Period { get; set; }

        [Optional]
        [XmlElement("forward", Namespace = Constants.Chart)]
        public RequiredValue<double> Forward { get; set; }

        [Optional]
        [XmlElement("backward", Namespace = Constants.Chart)]
        public RequiredValue<double> Backward { get; set; }

        [Optional]
        [XmlElement("intercept", Namespace = Constants.Chart)]
        public RequiredValue<double> Intercept { get; set; }

        [Optional]
        [XmlElement("dispRSqr", Namespace = Constants.Chart)]
        public NullableValue<bool> DisplayRSquaredValue { get; set; }

        [Optional]
        [XmlElement("dispEq", Namespace = Constants.Chart)]
        public NullableValue<bool> DisplayEquation { get; set; }

        [Optional]
        [XmlElement("trendlineLbl", Namespace = Constants.Chart)]
        public TrendlineLabel TrendlineLabel { get; set; }

        [Optional]
        [XmlElement("extLst", Namespace = Constants.Chart)]
        public ExtensionList ExtensionList { get; set; }

        public Trendline() { }
    }
}
